﻿using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using XchangeStreamer.Core.Publisher;

namespace XchangeStreamer.Publisher.SDK
{
    internal sealed class Publisher : ClientBase<IPublisher>, IPublisher
    {
        #region Public Const.

        public Publisher(Binding binding, EndpointAddress remoteAddress)
            : base(binding, remoteAddress)
        {
        }

        #endregion

        #region IPublisher Members

        public IAsyncResult BeginPublish(System.ServiceModel.Channels.Message message, AsyncCallback callback, object state)
        {
            return this.Channel.BeginPublish(message, callback, state);
        }

        public void EndPublish(IAsyncResult result)
        {
            this.Channel.EndPublish(result);
        }

        public int CreateTopic(string topicName)
        {
            return this.Channel.CreateTopic(topicName);
        }

        public void DeleteTopic(int topicId)
        {
            this.Channel.DeleteTopic(topicId);
        }

        public void UpdateTopic(int topicId, string topicName)
        {
            this.Channel.UpdateTopic(topicId, topicName);
        }

        #endregion
    }
}